USE [AnotherSuccessfulProcedure]

IF EXISTS (SELECT * FROM sysobjects WHERE id = object_id(N'[dbo].[PlayersSelectTop5Dominators]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
BEGIN
	DROP PROCEDURE dbo.PlayersSelectTop5Dominators
END


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Neil Wilson
-- Create date: 09/03/08
-- Description:	Players Table Select - Top 5 Dominating Players
-- =============================================
CREATE PROCEDURE PlayersSelectTop5Dominators
	
AS

BEGIN

SELECT  TOP 5  PlayerName, count(Attacker_Playerid) as [Count], PlayerId FROM Dominations
INNER JOIN PlayerNameList ON Attacker_Playerid = PlayerNameList.PlayerID
group by Attacker_Playerid, PlayerName, PlayerId
order by [Count] DESC

END
GO

--  PlayersSelectTop5Dominators 
